package com.exam.ch9;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

public class JEditorPane1 {

	public static void main(String[] args) {
		
		JEditorPane editPane = null;
		try{
		  File file = new File ("src/com/exam/ch9/docs/JEditorPane_1.html");
	    	  String str = file.getAbsolutePath();
	    	  str = "file:"+str;
	    	  editPane = new JEditorPane();
	    	  editPane.setPage(str);
	    	}
		catch(IOException ioe){
		  ioe.printStackTrace(System.err);
		  System.exit(0);
		}
		editPane.setEditable(false);

		JFrame f = new JFrame("JEditorPane1");
		f.setContentPane(new JScrollPane(editPane));
		f.setSize(200,250);
    	f.setVisible(true);
    	f.addWindowListener(new WindowAdapter() {            
    		public void windowClosing(WindowEvent e) {                    
    		 	  System.exit(0);            
    		  }        
    	});   
		
		
	}
}
